<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="div">
        <!-- 输入年龄，根据年龄判断去哪个网站 -->
        <input type="text" v-model="age" >
        <a :href="age>=18?url0:url1">好玩的网站</a>
       

    </div>

    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <script>

        var app = Vue.createApp({

            data: function () {
                return {
                    age: 0,
                    url1:'https://www.4399.com',
                    url0:'https://www.taobao.com'
                }
            },
            // 存放一些方法，供事件调用
            methods: {
                onClick(e) {
                    // 阻止冒泡
                    // e.stopPropagation();
                    this.num++;
                },
                onAdd(n1,n2){
                    e.preventDefault();
                    
                    this.num = n1+n2
                }
            },


        }).mount('#div');

    </script>
</body>

</html>